package cn.youyeku.zsxh.Utils;

import android.graphics.Color;
import android.widget.CheckBox;

/**
 * Created by youye on 17-5-27.
 */

public class widgetsUtils {

    //需要同步修改ｃｏｌｏｒ的值因为这样做放在代码可以动态设置　不用通过getResources().getColor(R.color.mycolor); 获取颜色
    public final static String NOT_CHECKED="#101010";
    public final static String CHECKED="#4abfed";


    //设置根据当前选择状态反选toggle
 public static void toggleCheckBoxAndText(CheckBox checkBox) {


     LogUtils.w("设置了颜色");
     Boolean mode =  checkBox.isChecked();

     if(mode){
         checkBox.setChecked(false);
         checkBox.setTextColor(Color.parseColor(NOT_CHECKED));
     }else {

         checkBox.setChecked(true);
         checkBox.setTextColor(Color.parseColor(CHECKED));
     }

 
  }
    public static void toggleCheckBoxAndText(CheckBox checkBox,Boolean mode) {
        if(mode){
            checkBox.setChecked(true);
            checkBox.setTextColor(Color.parseColor(CHECKED));
        }else {
            checkBox.setChecked(false);
            checkBox.setTextColor(Color.parseColor(NOT_CHECKED));

        }


    }


}
